var add=document.getElementsByClassName("add")[0];
var sub=document.getElementsByClassName("sub")[0];
let count=document.getElementsByClassName("count-var")[0];

add.onclick = function(){
    var value = parseInt(count.value);
    count.value = value + 1;
}

sub.onclick = function(){
    var value = parseInt(count.value);
    if (value > 1) {
        count.value = value - 1;
    }
}